package com.atguigu.yygh.hosp.controller;

import com.atguigu.yygh.common.result.Result;
import com.atguigu.yygh.hosp.service.ScheduleService;
import com.atguigu.yygh.model.hosp.Schedule;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @ClassName ScheduleController
 * @Description: 类描述
 * @Author: admin
 * @CreateDate: 2024/6/13 10:53
 * @UpdateUser: 更新人
 * @UpdateDate: 2024/6/13 10:53
 * @UpdateRemark: 更新的信息
 * @Version: 1.0
 */

@RequestMapping("/admin/hosp/Schedule")
//@CrossOrigin //解决跨域问题
@RestController
public class ScheduleController {

    @Autowired
    private ScheduleService scheduleService;

    @ApiOperation(value = "查询排班规则数据")
    @GetMapping("getScheduleRule/{page}/{limit}/{hoscode}/{depcode}")
    public Result getScheduleRule(
            @PathVariable("page") Long page,
            @PathVariable("limit") Long limit,
            @PathVariable("hoscode") String hoscode,
            @PathVariable("depcode") String depcode){
        Map<String, Object> map=scheduleService.getRuleSchedule(page, limit, hoscode, depcode);
        return Result.ok(map);
    }

    @ApiOperation(value = "查询排班详细信息")
    @GetMapping("getScheduleDetail/{hoscode}/{depcode}/{workDate}")
    public Result getScheduleDetail(
            @PathVariable("hoscode") String hoscode,
            @PathVariable("depcode") String depcode,
            @PathVariable("workDate") String workDate
    ){
        List<Schedule> list=scheduleService.getDetailSchedule(hoscode, depcode, workDate);
        return Result.ok(list);
    }

}
